package com.ctsi.zzzx.application;


import org.mybatis.spring.annotation.MapperScan;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.cloud.client.SpringCloudApplication;
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.scheduling.annotation.EnableScheduling;

import java.nio.charset.Charset;

/**
 * @author: zhangjw
 * @Date: 2018/11/12 16:27
 * @Description:
 */
@SpringBootApplication
@SpringCloudApplication
@EnableEurekaClient
@EnableFeignClients(basePackages = {"com.ctsi"})
@EnableCircuitBreaker
@EnableScheduling
@EntityScan("com.ctsi")
@MapperScan("com.ctsi.**.mapper")
public class ZzzxApplication {
    private static final Logger logger = LoggerFactory.getLogger(ZzzxApplication.class);

    public static void main(String[] args) {
        System.setProperty("hibernate.dialect.storage_engine","innodb");
        SpringApplication.run(ZzzxApplication.class,args);
        logger.error("默认字符集{}", Charset.defaultCharset());
    }

//    @Autowired
//    private IOrganiseService organiseService;
//
//    @Autowired
//    private PersonEntityManager personEntityManager;
//
//    @Autowired
//    private ResourceLoader resourceLoader;
//
//    @Autowired
//    private PermissionRole roleService;
//
//    @PostConstruct
//    public void init() throws IOException {
//        Resource resource = resourceLoader.getResource("classpath:70Ren.json");
//        File json = resource.getFile();
//        ObjectMapper objectMapper = new ObjectMapper();
//        objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
//        List<AddPersonVO> result = objectMapper.readValue(json,new TypeReference<List<AddPersonVO>>(){});
//        int i = 0;
//        String te = "(";
//        for (AddPersonVO vo : result) {
//
//            String mobilePhone = vo.getMobilePhone();
//            te=te+mobilePhone+",";
//            Long o = (Long) personEntityManager.selectPersonByPhone(mobilePhone);
//            Long o1 = (Long) personEntityManager.selectUserLoginByPhone(mobilePhone);
//            if(o==0&&o1==0){
//                String s = organiseService.addPersonWithAcc(vo, "admin", true);
//            }else {
//                i=i+1;
//                System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>手机号已经存在："+mobilePhone);
//            }
//        }
//        te = te+")";
//        System.out.println(te);
//        System.out.println("00000000000000000000000000000000000》》》》》》》》"+i);
//    }
}
